import { Repository } from "typeorm";
import { Injectable } from "@nestjs/common";
import { InjectRepository } from "@nestjs/typeorm";

import { Formula, Paster, FormulaGateway, PasterGateway } from "qqlx-core";
import { FormulaSchema, PasterSchema } from "qqlx-cdk";

import { PgDao } from "../../lib/dao.pg.id";

@Injectable()
export class PasterDao extends PgDao<Paster> {
  constructor(
    @InjectRepository(PasterSchema)
    readonly repo: Repository<Paster>,
  ) {
    super({
      repository: repo,
      relations_name: PasterGateway.relations,
    });
  }
}

@Injectable()
export class FormulaDao extends PgDao<Formula> {
  constructor(
    @InjectRepository(FormulaSchema)
    readonly repo: Repository<Formula>,
  ) {
    super({
      repository: repo,
      relations_name: FormulaGateway.relations,
    });
  }
}
